/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simple;

import algorithm.AlgorithmState;
import algorithm.StopCriterion;

/**
 *
 * @author Pierre
 */
public class NumberOfGenerationsStopCriterion implements StopCriterion {

    private int nGenerations;

    public NumberOfGenerationsStopCriterion(int nGenerations) {
        this.nGenerations = nGenerations;
    }

    public boolean isDone(AlgorithmState state) {
        if (state.getNGenerations() >= nGenerations) {
            return true;
        }
        return false;
    }
}
